<template>
	<cl-select-load-more
		ref="clSelectLoadMore"
		v-model="id"
		placeholder="请选择"
		:apiFn="apiFn"
		@change="change"
		clearable
		:reduceS="true"
	>
		<template v-slot="{ data }">
			<el-option
				v-for="(item,index) in data"
				:key="index+'1'"
				:label="item.name"
				:value="item.id"
			/>
		</template>
	</cl-select-load-more>
</template>

<script>
export default {
	name: "selectTest",
	props: {
		value: {
			type: [String, Number]
		}
	},
	data() {
		return {
			id: "",
			// 请求的参数
			query: {
				dept_id: "",
				biz_id: "",
				status: 1,
				is_teacher: 1
			},
			count:0
		};
	},
	watch: {
		value(v) {
			this.id = v;
		}
	},
	methods: {
		change(v) {
			this.$emit("change", v);
			this.$emit("input", v);
		},
		/**
		 * @parmas query 请求的参数
		 */
		init(query) {
			this.query = query;

			this.$refs.clSelectLoadMore.init();
		},
		apiFn(v) {
			let query = {
				...this.query,
				...v
			};
			return  this.$service.ad.NewtemplateList(query);
		}
	}
};
</script>

<style lang="scss" scoped></style>
